package com.woniuxy.hospital.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
import com.woniuxy.hospital.entity.HplDoctor;
import com.woniuxy.hospital.entity.HplHospitalization;
import com.woniuxy.hospital.entity.HplHospitalizationList;
import com.woniuxy.hospital.entity.HplTitle;
import com.woniuxy.hospital.mapper.HplDepartmentMapper;
import com.woniuxy.hospital.mapper.HplHospitalizationListMapper;
import com.woniuxy.hospital.mapper.HplHospitalizationMapper;
import com.woniuxy.hospital.mapper.HplTitleMapper;
import com.woniuxy.hospital.service.IHplHospitalizationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jobob,xal
 * @since 2021-08-12
 */
@Service
public class HplHospitalizationServiceImpl extends ServiceImpl<HplHospitalizationMapper, HplHospitalization> implements IHplHospitalizationService {
@Autowired
private HplHospitalizationListMapper hplHospitalizationListMapper;
@Autowired
private HplDepartmentMapper hplDepartmentMapper;
@Autowired
private HplTitleMapper hplTitleMapper;
    @Override
    public List<HplHospitalizationList> getByStatue(String status) {
        List<HplHospitalizationList> re=hplHospitalizationListMapper.getByStatue(status);
        re.forEach(hpl->{
          hpl.getDoctor().setDepName(hplDepartmentMapper.selectById(hpl.getDoctor().getDepId()).getName());
          hpl.getDoctor().setTitleName(hplTitleMapper.selectById(hpl.getDoctor().getTitleId()).getName());
        });
        return re;
    }
}
